﻿using System;
using System.Collections.Generic;

namespace Microsoft.Goldenlight.Collections
{
    /// <summary>
    /// 	Class that provides extension methods to ICollection
    /// </summary>
    public static class CollectionExtensions
    {
        #region Add

        /// <summary>
        /// 	Add a range of items to a collection.
        /// </summary>
        /// <typeparam name="T"> Type of objects within the collection. </typeparam>
        /// <param name="collection"> The collection to add items to. </param>
        /// <param name="items"> The items to add to the collection. </param>
        public static void AddRange<T>(this ICollection<T> collection, IEnumerable<T> items)
        {
            if (collection == null)
            {
                throw new ArgumentNullException("collection");
            }
            if (items == null)
            {
                throw new ArgumentNullException("items");
            }
            foreach (var item in items)
            {
                collection.Add(item);
            }
        }

        #endregion
    }
}